import { EPlayerItemPosType } from "../../../../../Message/Public/EPlayerItemPosType";
import { ItemConfig } from "../../../resource/ItemConfig";
import { ItemData } from "../../../resource/info/ItemData";
import { SPetInfo } from "../../../../../Message/Game/SPetInfo";
import { PetUtil } from "../../pet/info/PetUtil";
type int = number;
//class PetEquipUtil
    
    export  class PetEquipUtil
    {
        

        public static getPetIdByPoseType(arg1: int): int
        {
            if (arg1 >= EPlayerItemPosType._EPlayerItemPosTypePetEquipBase) 
            {
                return arg1 - EPlayerItemPosType._EPlayerItemPosTypePetEquipBase;
            }
            return -1;
        }

        public static getJewelAmountByLevel(arg1: Array<any>, arg2: int): int
        {
            var loc2=null;
            var loc4=null;
            var loc5=0;
            var loc6=0;
            var loc1=0;
            var loc3=0;
            loc5 = 0;
            while (loc5 < arg1.length) 
            {
                if ((loc2 = arg1[loc5]) && loc2.itemExInfo) 
                {
                    loc6 = 1;
                    while (loc6 <= 6) 
                    {
                        if ((loc3 = loc2.itemExInfo["hole" + loc6]) > 1) 
                        {
                            if ((loc4 = ItemConfig.instance.getInfoByCode(loc3)) && loc4.item.itemLevel >= arg2) 
                            {
                                loc1 = loc1 + 1;
                            }
                        }
                        ++loc6;
                    }
                }
                ++loc5;
            }
            return loc1;
        }

        public static isOverLevel(arg1: ItemData, arg2: SPetInfo): Boolean
        {
            if (arg2 == null || arg1 == null) 
            {
                return false;
            }
            var loc1=PetUtil.getFourDigitLevel(arg2.reinLevel, arg2.level);
            if (loc1 < arg1.itemInfo.item.level) 
            {
                return true;
            }
            return false;
        }
    }
